home *** CD-ROM | disk | FTP | other *** search
/ Mac OS on the PowerPC Mic…rocessor - In Store Demo / Mac OS on the PowerPC Microprocessor.iso / MacOS / MacOS.dxr / 00044_Index_script.ls < prev    next >
Encoding:
Text File  |  1996-05-13  |  3.3 KB  |  96 lines

  1. global gGraphicPath, gFileName, glastline, gkeywordtext, gSelLine, glineoffset, gColor, gBookmark, gSpriteSetList, objGrid, objIndexBtn, objalphabetbtn, objBookmark
  2.  
  3. on startindex
  4.   set the mouseDownScript to "indexMouseDownScript"
  5.   mStartIndex(objGrid)
  6.   if gSelLine = 0 then
  7.     showKeyword(1, 0)
  8.   else
  9.     showKeyword(gSelLine, 1)
  10.     mDrawKeywords(objGrid, gSelLine)
  11.   end if
  12. end
  13.  
  14. on setIndexBtn
  15.   set tMaxKwdFld to 24
  16.   set gSelLine to 0
  17.   set glastline to the number of lines in gkeywordtext
  18.   if gBookmark then
  19.     set objBookmark to birth(script "bookmark_script")
  20.     set objGrid to birth(script "Index_grid_script")
  21.     if glastline > tMaxKwdFld then
  22.       add(gSpriteSetList, [26, 37, 28, 29, 30, 31, 32, 33, 35, 36, 38])
  23.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36, 38])
  24.     else
  25.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36, 38])
  26.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36, 38])
  27.     end if
  28.   else
  29.     set objBookmark to birth(script "120_bookmark_script")
  30.     set objGrid to birth(script "120_Index_grid_script")
  31.     if glastline > tMaxKwdFld then
  32.       add(gSpriteSetList, [26, 37, 28, 29, 30, 31, 32, 33, 35, 36])
  33.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  34.     else
  35.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  36.       add(gSpriteSetList, [26, 37, 28, 29, 32, 33, 35, 36])
  37.     end if
  38.   end if
  39.   set the text of cast 35 to the text of cast 32
  40.   set the text of cast 34 to line 1 to tMaxKwdFld of gkeywordtext
  41.   set pictfilepath to gGraphicPath & getProp(gFileName, #Alphabet)
  42.   blitPictInitFile(objalphabetbtn, pictfilepath)
  43. end
  44.  
  45. on killIndexBtn
  46.   blitPictDispose(objIndexBtn)
  47.   blitPictDispose(objalphabetbtn)
  48. end
  49.  
  50. on showKeyword lineNumber, switchOn
  51.   set the foreColor of cast 34 to getAt(gColor, 4)
  52.   if glastline > 24 then
  53.     if lineNumber < 3 then
  54.       set glineoffset to 0
  55.       set the text of cast 34 to line 1 to 23 of gkeywordtext & RETURN
  56.       set the visible of sprite 30 to 0
  57.       set the visible of sprite 31 to 1
  58.       updateStage()
  59.       if switchOn then
  60.         set the foreColor of line lineNumber of cast 34 to getAt(gColor, 5)
  61.       end if
  62.     else
  63.       if (lineNumber + 23) > glastline then
  64.         set glineoffset to glastline - 24
  65.         set theText to line glastline - 22 to glastline of gkeywordtext
  66.         set the text of cast 34 to RETURN & theText
  67.         set the visible of sprite 30 to 1
  68.         set the visible of sprite 31 to 0
  69.         updateStage()
  70.         if switchOn then
  71.           set the foreColor of line lineNumber - glineoffset of cast 34 to getAt(gColor, 5)
  72.         end if
  73.       else
  74.         set glineoffset to lineNumber - 2
  75.         set theText to line lineNumber to lineNumber + 21 of gkeywordtext
  76.         set the text of cast 34 to RETURN & theText & RETURN
  77.         set the visible of sprite 30 to 1
  78.         set the visible of sprite 31 to 1
  79.         updateStage()
  80.         if switchOn then
  81.           set the foreColor of line 2 of cast 34 to getAt(gColor, 5)
  82.         end if
  83.       end if
  84.     end if
  85.   else
  86.     set the visible of sprite 30 to 0
  87.     set the visible of sprite 31 to 0
  88.     updateStage()
  89.     set the text of cast 34 to gkeywordtext
  90.     set the foreColor of cast 34 to getAt(gColor, 4)
  91.     if switchOn then
  92.       set the foreColor of line lineNumber of cast 34 to getAt(gColor, 5)
  93.     end if
  94.   end if
  95. end
  96.